package it.paybay.ipay.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;

import com.mongodb.Mongo;
 
@Configuration
public class SpringMongoDbConfig extends AbstractMongoConfiguration {
 
	@Override
	public @Bean Mongo mongo() throws Exception {
		return new Mongo("localhost");
	}
 
	@Override
	public @Bean MongoTemplate mongoTemplate() throws Exception {
		MongoTemplate mongoTemplate2 = new MongoTemplate(mongo(), getDatabaseName());
		return mongoTemplate2;
	}
	

	@Override
	public String getDatabaseName() {
		return "iPayTest";
	}
 
}
